package com.qzsoft.zhjd.asphalt.modules.projectstatistics.controller;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.qzsoft.zhjd.asphalt.modules.projectstatistics.dto.ProjectStatisticsListDto;
import com.qzsoft.zhjd.asphalt.modules.projectstatistics.service.ProjectStatisticsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.common.utils.ResultUtils;

/**
 * @ClassName ProjectStatisticsController
 * @Description 项目统计
 * @author linhuawei
 * @since 2021-12-06
 */
@RestController
@RequestMapping("/api/asphaltProjectStatistics")
public class ProjectStatisticsController {

    @Autowired
    private ProjectStatisticsService projectStatisticsService;

    /**
     * @Title page
     * @Description 获取分页列表
     * @param params 查询条件
     * @return 分页数据列表
     */
    @RequiresPermissions("asphalt:projectstatistics")
    @GetMapping("/page")
    public Result<IPage<ProjectStatisticsListDto>> page(@RequestParam Map<String, Object> params) {
        IPage<ProjectStatisticsListDto> page = projectStatisticsService.page(params);
        return ResultUtils.ok(page);
    }

    /**
     * @Title export
     * @Description 项目统计数据导出
     * @param params 查询条件
     */
    @RequiresPermissions("asphalt:projectstatistics")
    @GetMapping("/export")
    public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        projectStatisticsService.export(params, response);
    }

}
